﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BestLifePOS_Core.Data.Core;
using BestLifePOS_Core.DomainObjects;
using BestLifePOS_Core.Exceptions.DataBase;
using System.Data.SqlClient;
using System.Data;


namespace BestLifePOS_Core.Data.Commands
{
    class BestLifeReciptCancelDataAction : BestLifeDataAction<int>
    {

            private string GvrcptId;
            private string GvrcptReason;
            private string GvrcptCancel;
            private string GvrcptUser;

            public BestLifeReciptCancelDataAction(string PReciptId, string PrcptReason,string PrcptCancel,string PUser)
            {
                GvrcptId = PReciptId;
                GvrcptReason = PrcptReason;
                GvrcptCancel = PrcptCancel;
                GvrcptUser = PUser;
            }

            public override int Body(SqlConnection PConn)
            {
                try
                {
                    SqlCommand LvCommand = new SqlCommand();
                    LvCommand.Connection = PConn;
                    LvCommand.CommandType = CommandType.StoredProcedure;
                    LvCommand.CommandText = "dbo.Cancelrcptdetails";


                    //LvCommand.Parameters.Add(new SqlParameter("@R_Id", Gvrcpt.R_ID));
                    LvCommand.Parameters.Add(new SqlParameter("@Rcpt_Id", GvrcptId));
                    LvCommand.Parameters.Add(new SqlParameter("@RcptReason", GvrcptReason));
                    LvCommand.Parameters.Add(new SqlParameter("@RcptCancel", GvrcptCancel));
                    LvCommand.Parameters.Add(new SqlParameter("@User", GvrcptUser));

                  
                    //SqlDataReader LvReader = LvCommand.ExecuteReader();
                    int LvCount = LvCommand.ExecuteNonQuery();
                    return LvCount;
                    //string Lvreturn = LvReader.GetValue(0).ToString();
                    //return output.Value.ToString();

                }
                catch (BestlifeDatabaseException e)
                {
                    throw new BestlifeDatabaseException(e);
                }

            }

    }
}
